package com.ykq.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: 闫克起  view object 视图对象
 * @Description:统一格式的json数据
 * @Date: Create in 11:21 2024/10/12
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private Integer code;//状态码
    private String msg;//提示消息

    private Object data;//数据

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static R ok(){
        return new R(200,"操作成功");
    }
    public static R ok(Object data){
        return new R(200,"操作成功",data);
    }
    public static R error(String msg){
        return new R(500,"操作失败");
    }
}
